<template>
  <div v-if="is.isshow">
    <input ref="inpt" type="text" v-model="vister" />
    <button>确认</button>
  </div>
</template>

<script setup lang="ts">
import {nextTick, onMounted, onUpdated, ref} from "vue";
const is = defineProps({
  isshow: Boolean,
});
const vister = ref("");

const inpt = ref();

const fin = () => {
  nextTick(() => {
    // DOM 更新完后执行代码
    inpt.value.focus();
  });
};
defineExpose({fin});
// onUpdated(() => {
//   inpt.value.focus();
// });
</script>

<style></style>
